package com.jxc.summer.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jxc.summer.dao.StorageMapper;
import com.jxc.summer.service.StorageService;

@Service
public class StorageServiceImpl implements StorageService {

	@Autowired
	private StorageMapper storageMapper;
	
	@Override
	public Map<String, Object> pageList(Map<String, Object> params) {
		List<Map<String, Object>> list = storageMapper.pageList(params);
		int count = storageMapper.pageListCount(params);
		// package result
		Map<String, Object> maps = new HashMap<String, Object>();
		maps.put("recordsTotal", count);		// 总记录数
		maps.put("recordsFiltered", count);	// 过滤后的总记录数
		maps.put("data", list); 
		return maps;
	}
	@Override
	
	public List<Map<String, Object>> getStorage(Map<String, Object> params) {
		List<Map<String, Object>> list = storageMapper.getStorage(params);
		return list;
	}

	@Override
	public int update(Map<String, Object> params) {
		return storageMapper.update(params);
	}

	@Override
	public int delete(Map<String, Object> params) {
		return storageMapper.delete(params);
	}

}
